home *** CD-ROM | disk | FTP | other *** search
/ PC Action 1997 January / PCA0197.ISO / demos / ambe / roxy / roxy.dxr / 00001_generic domain rules.ls next >
Encoding:
Text File  |  1996-10-28  |  12.1 KB  |  384 lines

  1. on cursorOff
  2.   global colorcrsr, YugoCursors, gCursorSwitch
  3.   if objectp(colorcrsr) then
  4.     colorcrsr(mGetSetCursor, getProp(YugoCursors, #noCursor))
  5.     set gCursorSwitch to #off
  6.   else
  7.     cursor(200)
  8.     set gCursorSwitch to #off
  9.   end if
  10. end
  11.  
  12. on cursorOn
  13.   global colorcrsr, YugoCursors, thisCursor, gCursorSwitch
  14.   if gCursorSwitch = #off then
  15.     if objectp(colorcrsr) then
  16.       colorcrsr(mGetSetCursor, getProp(YugoCursors, thisCursor))
  17.     else
  18.       castCursor(getProp(YugoCursors, thisCursor))
  19.     end if
  20.     set gCursorSwitch to #on
  21.   end if
  22. end
  23.  
  24. on setCursorQuality recommendation
  25.   global oPuppeteer
  26.   set the cursorQuality of oPuppeteer to recommendation
  27. end
  28.  
  29. on castCursor cursorID
  30.   set myCursorOffset to 2500
  31.   if integerp(cursorID) then
  32.     set whichCursor to cursorID - 6000
  33.   else
  34.     put "castCursor(): wow, a cursor label: "
  35.     put cursorID
  36.     exit
  37.   end if
  38.   set cMask to myCursorOffset + (whichCursor * 2)
  39.   cursor([cMask - 1, cMask])
  40. end
  41.  
  42. on killVideo
  43.   global lastScoreSprite
  44.   set vidSprite to 44
  45.   set the movieRate of sprite vidSprite to 0
  46.   set the locV of sprite vidSprite to -500
  47.   updateStage()
  48.   set the castNum of sprite vidSprite to 7
  49.   puppetSprite(vidSprite, 0)
  50. end
  51.  
  52. on pushVideo
  53.   set vidSprite to 44
  54.   set the movieTime of sprite 44 to 0
  55.   updateStage()
  56.   set the movieRate of sprite 44 to 1
  57.   repeat while (the movieRate of sprite 44 <> 1) and not (the mouseDown)
  58.     updateStage()
  59.   end repeat
  60. end
  61.  
  62. on setCurrentLocation suggestion
  63.   return "Use the goTo() function instead.."
  64. end
  65.  
  66. on goTo destination, transition
  67.   global oPuppeteer, oStoryteller, builderwindow, gPreloading, gScanFinish, colorcrsr, YugoCursors, thisCursor, gCursorSwitch, gPeekAlertEnabled
  68.   if objectp(colorcrsr) then
  69.     colorcrsr(mGetSetCursor, getProp(YugoCursors, #noCursor))
  70.   else
  71.     cursor(200)
  72.   end if
  73.   set gCursorSwitch to #off
  74.   if (destination = #destination) or (transition = #transition) then
  75.     exit
  76.   end if
  77.   setAt(getProp(the lsStateData of oStoryteller, #previousLocation), 1, getAt(getProp(the lsStateData of oStoryteller, #currentLocation), 1))
  78.   setAt(getProp(the lsStateData of oStoryteller, #currentLocation), 1, destination)
  79.   if the castNum of sprite 44 <> 7 then
  80.     killVideo()
  81.     moveMovies(oPuppeteer)
  82.   end if
  83.   if transition <> 0 then
  84.     setTransition(oPuppeteer, transition)
  85.   end if
  86.   moveToLocation(oPuppeteer)
  87.   if getPos(the windowList, builderwindow) then
  88.     tell builderwindow
  89.       refreshCast()
  90.       refreshHotspots()
  91.     end tell
  92.   end if
  93.   if gPreloading = 1 then
  94.     preloadLocations()
  95.   else
  96.   end if
  97.   set lsMoveCounter to getProp(the lsStateData of oStoryteller, #moveCount)
  98.   set oldCount to getAt(lsMoveCounter, 1)
  99.   setAt(lsMoveCounter, 1, oldCount + 1)
  100.   if (getState(oStoryteller, #playerHasPeekUnit) <> 0) and gPeekAlertEnabled then
  101.     if (gScanFinish <> 0) and (the ticks > gScanFinish) then
  102.       setState(oStoryteller, #PKscanStatus, #ReadyForPlayback)
  103.       setState(oStoryteller, #PeekDisplay, #scanStatus)
  104.       set gScanFinish to 0
  105.     end if
  106.     if getState(oStoryteller, #BarOnline) and (getState(oStoryteller, #PeekDisplay) = #None) then
  107.       set showTime to getState(oStoryteller, #hauntDelay)
  108.       if (getAt(lsMoveCounter, 1) > showTime) and (destination <> #LivingRmBarCU2) then
  109.         spawnGhostlyEvent()
  110.         setProp(the lsStateData of oStoryteller, #hauntDelay, [12])
  111.       end if
  112.     end if
  113.     if getState(oStoryteller, #PeekDisplay) <> #None then
  114.       peekAlert()
  115.       setAt(lsMoveCounter, 1, 0)
  116.     end if
  117.   end if
  118.   return #OK
  119. end
  120.  
  121. on goBack
  122.   global oStoryteller
  123.   goTo(getState(oStoryteller, #previousLocation), #backOff)
  124. end
  125.  
  126. on idle
  127.   global lastCursor, thisCursor, cursorOffset, castCursorList, maxCursor, gClickLoc, gLastPsionSpinTime, oStoryteller, oPuppeteer, gCurrentHotspot, gItemInUse, domainIsReady, gPreloading, gStopTransitions, g16bit, gTransQuality, gFreezeInventory, gSoundPath, gOriginPoint, gMenuBottomY, gInventoryTopY, gDeferredTransit
  128.   if gDeferredTransit = #None then
  129.     if domainIsReady then
  130.       cursorOn()
  131.       if getState(oStoryteller, #itemInUse) = #None then
  132.         set thisCursor to #pointer
  133.       else
  134.         set thisCursor to getState(oStoryteller, #itemInUse)
  135.       end if
  136.       set gCurrentHotspot to #None
  137.       if the mouseV < gMenuBottomY then
  138.         if the number of menus = 0 then
  139.           installMenu(18)
  140.           if the number of menus > 2 then
  141.             if gTransQuality = #None then
  142.               set the checkMark of menuItem 1 of menu 3 to 1
  143.             end if
  144.             if gTransQuality = #Better then
  145.               set the checkMark of menuItem 2 of menu 3 to 1
  146.             end if
  147.             if gTransQuality = #Best then
  148.               set the checkMark of menuItem 3 of menu 3 to 1
  149.             end if
  150.           end if
  151.           set the checkMark of menuItem (8 - the soundLevel) of menu 2 to 1
  152.           set thisCursor to #pointer
  153.         end if
  154.       else
  155.         installMenu(0)
  156.       end if
  157.       if not gFreezeInventory then
  158.         if the mouseV > gInventoryTopY then
  159.           if the inventoryStatus of oPuppeteer = #cool then
  160.             set the inventoryStatus of oPuppeteer to #hot
  161.             updateInventory()
  162.             updateStage()
  163.           end if
  164.         else
  165.           if (the inventoryStatus of oPuppeteer = #hot) and (gClickLoc = #None) then
  166.             set the inventoryStatus of oPuppeteer to #cool
  167.             updateInventory()
  168.             updateStage()
  169.           end if
  170.         end if
  171.       end if
  172.       if listp(gClickLoc) then
  173.         set mouseLoc to gClickLoc - gOriginPoint
  174.       else
  175.         set mouseLoc to point(the mouseH, the mouseV) - gOriginPoint
  176.       end if
  177.       repeat with i in the lsLiveHotspots of oPuppeteer
  178.         if inside(mouseLoc, getAt(i, 2)) then
  179.           set myCursor to getAt(i, 1)
  180.           if myCursor = #itemInUse then
  181.             set thisCursor to getState(oStoryteller, #itemInUse)
  182.           else
  183.             set thisCursor to myCursor
  184.           end if
  185.           set gCurrentHotspot to i
  186.           exit repeat
  187.         end if
  188.       end repeat
  189.       if getState(oStoryteller, #itemInUse) = #None then
  190.         if (the mouseCast = getProp(the lsForegroundData of oPuppeteer, #Headgear)) or (the mouseCast = getProp(the lsForegroundData of oPuppeteer, #HeadgearOff)) then
  191.           set thisCursor to #pointer
  192.         end if
  193.       end if
  194.       if (gCurrentHotspot = #None) and (the inventoryStatus of oPuppeteer = #hot) then
  195.         set whichSlot to 1
  196.         repeat with i in [rect(77, 377, 144, 444), rect(147, 377, 214, 444), rect(217, 377, 284, 444), rect(287, 377, 354, 444), rect(357, 377, 424, 444), rect(427, 377, 494, 444), rect(497, 377, 564, 444)]
  197.           if inside(mouseLoc, i) then
  198.             set newItem to getAt(the lsInventory of oPuppeteer, whichSlot)
  199.             if newItem <> #None then
  200.               set gCurrentHotspot to [0, 0, ["useInventory(#" & newItem & ")"]]
  201.             end if
  202.             exit repeat
  203.             next repeat
  204.           end if
  205.           set whichSlot to whichSlot + 1
  206.         end repeat
  207.       end if
  208.       if thisCursor <> lastCursor then
  209.         if the movieRate of sprite 44 = 0 then
  210.           cursorDance(value(lastCursor & "To" & thisCursor))
  211.         else
  212.           cursorDance(0)
  213.         end if
  214.         set lastCursor to thisCursor
  215.       end if
  216.       if getState(oStoryteller, #BT_fragStatus) = #spinningNow then
  217.         if the ticks > (gLastPsionSpinTime + 3) then
  218.           refreshAlignmentPuzzle()
  219.           set gLastPsionSpinTime to the ticks
  220.         end if
  221.       end if
  222.       if getState(oStoryteller, #AMBERVISION) = #on then
  223.         playDomainEntrySound()
  224.         if (the lastEvent > (5 * 60)) and (the castNum of sprite 44 = 7) then
  225.           ripple()
  226.         end if
  227.       end if
  228.     end if
  229.     if listp(gClickLoc) then
  230.       set gClickLoc to #None
  231.     end if
  232.     if the lastEvent > (120 * 60) then
  233.       returnToSlideshow()
  234.     end if
  235.   else
  236.     do(gDeferredTransit)
  237.     if gDeferredTransit contains "waiting" then
  238.       if domainIsReady = 1 then
  239.         if getState(oStoryteller, #currentDomain) = the last word in gDeferredTransit then
  240.           set gDeferredTransit to #None
  241.         end if
  242.       end if
  243.     end if
  244.   end if
  245. end
  246.  
  247. on cursorDance cursorList
  248.   global colorcrsr, thisCursor, YugoCursors, gCPU
  249.   if gCPU <> #PC then
  250.     if not objectp(colorcrsr) then
  251.       cursor(-1)
  252.       set colorcrsr to colorcursor(mnew)
  253.     end if
  254.   end if
  255.   if not listp(cursorList) then
  256.     if objectp(colorcrsr) then
  257.       colorcrsr(mGetSetCursor, getProp(YugoCursors, thisCursor))
  258.     else
  259.       castCursor(getProp(YugoCursors, thisCursor))
  260.     end if
  261.     exit
  262.   end if
  263.   set flipBook to cursorList
  264.   if objectp(colorcrsr) then
  265.     repeat with flipper = 1 to count(flipBook)
  266.       startTimer()
  267.       colorcrsr(mGetSetCursor, getAt(flipBook, flipper))
  268.       repeat while 2 > the timer
  269.         nothing()
  270.       end repeat
  271.     end repeat
  272.   else
  273.     repeat with flipper = 1 to count(flipBook)
  274.       startTimer()
  275.       castCursor(getAt(flipBook, flipper))
  276.       repeat while 2 > the timer
  277.         nothing()
  278.       end repeat
  279.     end repeat
  280.   end if
  281. end
  282.  
  283. on inState stateVar, whichItem
  284.   global oStoryteller
  285.   set stateList to getProp(the lsStateData of oStoryteller, stateVar)
  286.   return getPos(stateList, whichItem)
  287. end
  288.  
  289. on trimState stateVar, whichItem
  290.   global oStoryteller
  291.   set stateList to getProp(the lsStateData of oStoryteller, stateVar)
  292.   set myPos to getPos(stateList, whichItem)
  293.   if myPos then
  294.     deleteAt(stateList, myPos)
  295.   end if
  296. end
  297.  
  298. on addState stateVar, whichItem
  299.   global oStoryteller
  300.   set stateList to getProp(the lsStateData of oStoryteller, stateVar)
  301.   set myPos to getPos(stateList, whichItem)
  302.   if not myPos then
  303.     append(stateList, whichItem)
  304.   end if
  305. end
  306.  
  307. on waitaSec startSwitch
  308.   global gSecStart
  309.   if voidp(gSecStart) then
  310.     set gSecStart to #idle
  311.   end if
  312.   if startSwitch = #start then
  313.     set gSecStart to the ticks
  314.     return #starting
  315.   else
  316.     set currentTime to the ticks
  317.     if currentTime > (gSecStart + 60) then
  318.       return #finished
  319.       set gSecStart to #idle
  320.     else
  321.       return #waiting
  322.     end if
  323.   end if
  324. end
  325.  
  326. on putDownThePhone
  327.   global oStoryteller, oPuppeteer
  328.   if (getState(oStoryteller, #phoneButtonsPressed) > 0) and inState(#hauntsRemaining, #spookyOperator) then
  329.     setProp(the lsStateData of oStoryteller, #phoneButtonsPressed, [7])
  330.     setState(oStoryteller, #ghostlyPhoneCall, #speaking)
  331.     setProp(the lsStateData of oStoryteller, #phoneButtonsPressed, [0])
  332.   else
  333.     setState(oStoryteller, #playerIsExaminingPhone, 0)
  334.     setState(oStoryteller, #ghostlyPhoneCall, #done)
  335.     setProp(the lsStateData of oStoryteller, #phoneButtonsPressed, [0])
  336.     setTransition(oPuppeteer, #fadeIn)
  337.   end if
  338.   updateDisplay(oPuppeteer)
  339. end
  340.  
  341. on updateInventory
  342.   global oPuppeteer, oStoryteller, gOriginPoint
  343.   set foundationSprite to 3
  344.   set itemV to 410
  345.   set itemH to 110
  346.   set itemInHand to getState(oStoryteller, #itemInUse)
  347.   set lsInventory to the lsInventory of oPuppeteer
  348.   set lsInventoryData to the lsInventoryData of oPuppeteer
  349.   if the inventoryStatus of oPuppeteer = #hot then
  350.     repeat with i = 1 to 7
  351.       set itemName to getAt(lsInventory, i)
  352.       set itemSprite to foundationSprite + i
  353.       if (itemName = #None) or (itemName = itemInHand) then
  354.         set the castNum of sprite itemSprite to 6
  355.         set the loc of sprite itemSprite to point(320, -360) + gOriginPoint
  356.       else
  357.         puppetSprite(itemSprite, 1)
  358.         set the castNum of sprite itemSprite to getAt(getProp(lsInventoryData, itemName), 1)
  359.         set the loc of sprite itemSprite to point(itemH, itemV) + gOriginPoint
  360.       end if
  361.       set itemH to itemH + 70
  362.     end repeat
  363.   else
  364.     repeat with i = 1 to 7
  365.       set itemName to getAt(lsInventory, i)
  366.       set itemSprite to foundationSprite + i
  367.       if (itemName = #None) or (itemName = itemInHand) then
  368.         set the castNum of sprite itemSprite to 6
  369.         set the loc of sprite itemSprite to point(320, -360) + gOriginPoint
  370.       else
  371.         puppetSprite(itemSprite, 1)
  372.         set the castNum of sprite itemSprite to getAt(getProp(lsInventoryData, itemName), 2)
  373.         set the loc of sprite itemSprite to point(itemH, itemV) + gOriginPoint
  374.       end if
  375.       set itemH to itemH + 70
  376.     end repeat
  377.   end if
  378. end
  379.  
  380. on stashClick
  381.   global gClickLoc
  382.   set gClickLoc to point(the mouseH, the mouseV)
  383. end
  384.